


/*------------------------------------------------------------------------------

						TABLE 3: CONTRACT RETURN
						
------------------------------------------------------------------------------*/

use "$output/DA_reg", clear

label var res1 "Reserve ratio ($ R_{j,t^-}$)"
label var r "Asset return ($ x_{j,t}$)"
label var res00 "Lagged reserve ratio $ R_{j,t-1}$"

* capital ratio
egen highcap = xtile(cap), nq(2) by(year)
replace highcap = highcap-1
gen res1_highcap = res1*highcap
gen r_highcap = r*highcap
label var highcap "High insurer capital"
label var res1_highcap "Reserve ratio $ \times$ High insurer capital"
label var r_highcap "Asset return $ \times$ High insurer capital"

* size
egen large = xtile(Pa_ig), nq(4) by(year)
replace large = large==4
gen res1_large = res1*large
gen r_large = r*large
label var large "Large insurer"
label var res1_large "Reserve ratio $ \times$ Large insurer"
label var r_large "Asset return $ \times$ Large insurer"

* low reserves and crisis
egen quantile_res1 = xtile(res1), nq(4)
gen lowres = (quantile_res1==1)
gen crisis = inlist(year,2008,2011,2012)
foreach x in lowres crisis {
gen res1_`x' = res1*`x'
gen r_`x' = r*`x'
}
label var lowres "Low reserves"
label var res1_lowres "Reserve ratio $ \times$ Low reserves"
label var r_lowres "Asset return $ \times$ Low reserves"
label var crisis "Crisis"
label var res1_crisis "Reserve ratio $ \times$ Crisis"
label var r_crisis "Asset return $ \times$ Crisis"

eststo clear

qui eststo: reghdfe y res1 r [aw=w], a(year) vce(cluster year matricule)

qui eststo: reghdfe y res1 r [aw=w], a(year matricule) vce(cluster year matricule)

foreach x in highcap large lowres {
qui eststo: reghdfe y res1 res1_`x' r r_`x' `x' [aw=w], a(year matricule) vce(cluster year matricule)
}

qui eststo: reghdfe y res1 res1_crisis r r_crisis [aw=w], a(year matricule) vce(cluster year matricule)

estout using "$results/y.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) mlabel(none) collabel(none) varwidth(50) drop(_cons) order(res1 r res1_* r_*)
estout using "$results/y_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)




/*------------------------------------------------------------------------------

					TABLE 6: CONTRACT RETURN PREDICTABILITY
						
------------------------------------------------------------------------------*/

use "$output/DA_reg", clear

label var res00 "Reserves at beginning of year $ t$"

eststo clear

qui eststo: reghdfe y res00 [aw=w], a(year) vce(cluster matricule year)

qui eststo: reghdfe f.y res00 [aw=w], a(year) vce(cluster matricule year)

qui eststo: reghdfe f2.y res00 [aw=w], a(year) vce(cluster matricule year)

qui eststo: reghdfe f3.y res00 [aw=w], a(year) vce(cluster matricule year)

qui eststo: reghdfe f4.y res00 [aw=w], a(year) vce(cluster matricule year)

estout using "$results/y-horizon.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) drop(_cons) order(res00) mlabel(none) collabel(none) varwidth(40)
estout using "$results/y-horizon_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)




/*------------------------------------------------------------------------------

			TABLE 7 & FIGURE 3: LONG-SHORT PORTFOLIO

------------------------------------------------------------------------------*/

use year PM_ouv_ig res0 y using "$output/DA_reg", clear

* long and short leg & portfolio weights

sort year res0
by year: gen w = 2*(_n-1)-(_N-1)
gen y_long = y if w>0
gen y_short = y if w<0
gen vw = abs(w)*PM_ouv_ig

* compute portfolio return

collapse (mean) y_long y_short (sd) sd_long=y_long sd_short=y_short [w=vw], by(year)
tsset year
gen y_ls = y_long-y_short
gen sd_ls = sd_long-sd_short

* bring r_f and r_m

merge 1:1 year using "$source/benchmark-return", keep(1 3) nogen
gen mktrf = r_euronext100 - euribor1y

* portfolio return statistics

local MeanReturn_b	"Mean return"	// string to store mean return of each portfolio
local MeanReturn_se	"           "	// string to store s.e. of mean return of each portfolio

local Alpha_b		"\addlinespace Alpha"	// string to store mean return of each portfolio
local Alpha_se		"                   "	// string to store s.e. of mean return of each portfolio

local Beta_b		"\addlinespace Beta"	// string to store mean return of each portfolio
local Beta_se		"                  "	// string to store s.e. of mean return of each portfolio

local SDReturn_b	"\addlinespace S.D. return"	// string to store mean return of each portfolio
local SDReturn_se	"                         "	// string to store s.e. of mean return of each portfolio

foreach x in short long ls {

* raw mean

qui newey y_`x', lag(2)

local temp	= _b[_cons]
local tempp = round(`temp',.0001)
local MeanReturn_b	= "`MeanReturn_b' &  `tempp' "

local temp	= _se[_cons]
local tempp = round(`temp',.00001)
local MeanReturn_se	= "`MeanReturn_se' & (`tempp')"

* market model

qui newey y_`x' mktrf, lag(2)

local temp	= _b[_cons]
local tempp = round(`temp',.0001)
local Alpha_b	= "`Alpha_b' &  `tempp' "

local temp	= _se[_cons]
local tempp = round(`temp',.00001)
local Alpha_se	= "`Alpha_se' & (`tempp')"

local temp	= _b[mktrf]
local tempp = round(`temp',.0001)
local Beta_b	= "`Beta_b' &  `tempp' "

local temp	= _se[mktrf]
local tempp = round(`temp',.00001)
local Beta_se	= "`Beta_se' & (`tempp')"

* standard deviation

qui newey sd_`x', lag(2)

local temp	= _b[_cons]
local tempp = round(`temp',.00001)
local SDReturn_b	= "`SDReturn_b' &  `tempp' "

local temp	= _se[_cons]
local tempp = round(`temp',.00001)
local SDReturn_se	= "`SDReturn_se' & (`tempp')"

}

* write output in tex file (table 7)

file open portfolio using "$results/long-short.tex", text write replace

file write portfolio "`MeanReturn_b'\\" _n
file write portfolio "`MeanReturn_se'\\" _n

file write portfolio "`Alpha_b'\\" _n
file write portfolio "`Alpha_se'\\" _n

file write portfolio "`Beta_b'\\" _n
file write portfolio "`Beta_se'\\" _n

file write portfolio "`SDReturn_b'\\" _n
file write portfolio "`SDReturn_se'\\" _n

file close portfolio




* figure 3

label var y_long "High-reserves contracts"
label var y_short "Low-reserves contracts"
line y_long y_short year, legend(on) lpattern(solid dash) ylabel(, angle(horizontal)) xlabel(2000(3)2015) xtitle("") ytitle("") graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))

graph export "$results/long-short-return.pdf", as(pdf) replace






/*------------------------------------------------------------------------------

						TABLE 5: FLOW REGRESSIONS

------------------------------------------------------------------------------*/

use "$output/DA_reg", clear

label var res00 "Lagged reserves"
label var cap "Capital ratio"
label var ly "Lagged contract return"
winsor cap
label var bancassureur "Bank-insurer"


*** OLS (Panel A)

eststo clear

foreach x in flow_ig_w1 inflow_ig_w1 redemp_ig_w1 forced_ig_w1 loginflow_ig {
qui eststo: reghdfe `x' res00 [aw=w], a(matricule year) vce(cluster matricule year)
}

estout using "$results/flow.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) order(res00) drop(_cons) collabel(none) mlabel(none) varwidth(20)

estout using "$results/flow_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)


*** IV (Panel B)

* first stage

eststo clear

eststo: reghdfe res00 lr l2share_bond l2share_stock l2share_re l2share_loan [aw=w], a(matricule year) cluster(matricule year)

label var lr "Lagged asset return"
label var l2share_bond "\addlinespace Lagged bond share"
label var l2share_stock "Lagged stock share"
label var l2share_re "Lagged real estate share"
label var l2share_loan "Lagged loan share"

estout using "$results/flowiv-firststage.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) drop(_cons) collabel(none) mlabel(none) varwidth(50)

estout using "$results/flowiv-firststage_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)

* second stage

eststo clear

foreach x in flow_ig_w1 inflow_ig_w1 redemp_ig_w1 forced_ig_w1 loginflow_ig {

qui eststo: reghdfe `x' l2share_re l2share_stock l2share_bond l2share_loan (res00=lr) [aw=w], a(matricule year) cluster(matricule year) old

}

estout using "$results/flowiv.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) order(res00) varlabels(_cons Constant) collabel(none) mlabel(none) drop(l2share_*) varwidth(20)

estout using "$results/flowiv_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)


*** LAG FURTHER

* first stage 2 lags

reghdfe res00 l2r l3share_bond l3share_stock l3share_re l3share_loan [aw=w], a(matricule year) cluster(matricule year)

* first stage 3 lags

reghdfe res00 l3r l4share_bond l4share_stock l4share_re l4share_loan [aw=w], a(matricule year) cluster(matricule year)

* second stage 2 lags

eststo clear

foreach x in flow_ig_w1 inflow_ig_w1 redemp_ig_w1 forced_ig_w1 loginflow_ig {

qui eststo: reghdfe `x' l3share_bond l3share_stock l3share_re l3share_loan (res00=l2r) [aw=w], a(matricule year) cluster(matricule year) old

}

estout using "$results/flowiv-lag2.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) order(res00) varlabels(_cons Constant) collabel(none) mlabel(none) drop(l3share_*) varwidth(20)

estout using "$results/flowiv-lag2_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)





/*------------------------------------------------------------------------------

						TABLE E.2: MORE COVARIATES

------------------------------------------------------------------------------*/

*** OLS (Panel A)

eststo clear

foreach x in flow_ig_w1 inflow_ig_w1 outflow_ig_w1 loginflow_ig {

qui eststo: reghdfe `x' res00 cap bancassureur [aw=w], a(year) vce(cluster matricule year) noconstant

qui eststo: reghdfe `x' res00 cap [aw=w], a(matricule year) vce(cluster matricule year) noconstant

qui eststo: reghdfe `x' res00 cap ly [aw=w], a(matricule year) vce(cluster matricule year) noconstant

}

estout using "$results/flow-control.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) order(res00 cap bancassureur) collabel(none) mlabel(none) varwidth(40) 

estout using "$results/flow-control_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)


*** IV (Panel V)

eststo clear

foreach x in flow_ig_w1 inflow_ig_w1 outflow_ig_w1 loginflow_ig {

qui eststo: reghdfe `x' cap bancassureur l2share_re l2share_stock l2share_bond l2share_loan (res00=lr) [aw=w], a(year) cluster(matricule year) old

qui eststo: reghdfe `x' cap l2share_re l2share_stock l2share_bond l2share_loan (res00=lr) [aw=w], a(matricule year) cluster(matricule year) old

qui eststo: reghdfe `x' cap ly l2share_re l2share_stock l2share_bond l2share_loan (res00=lr) [aw=w], a(matricule year) cluster(matricule year) old

}

estout using "$results/flowiv-control.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) order(res00) varlabels(_cons Constant) collabel(none) mlabel(none) drop(l2share_*) varwidth(40)

estout using "$results/flowiv-control_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)




/*------------------------------------------------------------------------------

						TABLE E.5: CRISES

------------------------------------------------------------------------------*/

* crisis dummy

gen crisis = inlist(year,2008,2011,2012)

* interaction terms

foreach x in res00 lr l2share_re l2share_stock l2share_bond l2share_loan {
gen `x'_crisis = `x'*crisis
}

label var crisis "Crisis"
label var res00_crisis "Lagged reserves $ \times$ Crisis"


* OLS

eststo clear

foreach x in flow_ig_w1 inflow_ig_w1 redemp_ig_w1 forced_ig_w1 loginflow_ig {

qui eststo: reghdfe `x' res00 res00_crisis [aw=w], a(matricule year) cluster(matricule year)
}

estout using "$results/flow-crisis.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) order(res00) varlabels(_cons Constant) collabel(none) mlabel(none) dro(_cons) varwidth(40)

estout using "$results/flow-crisis_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)


* IV

eststo clear

foreach x in flow_ig_w1 inflow_ig_w1 redemp_ig_w1 forced_ig_w1 loginflow_ig {

qui eststo: reghdfe `x' l2share_re l2share_stock l2share_bond l2share_loan l2share_re_crisis l2share_stock_crisis l2share_bond_crisis l2share_loan_crisis (res00 res00_crisis = lr lr_crisis) [aw=w], a(matricule year) cluster(matricule year) old

}

estout using "$results/flowiv-crisis.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) order(res00) varlabels(_cons Constant) collabel(none) mlabel(none) drop(l2share_*) varwidth(40)

estout using "$results/flowiv-crisis_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)




/*------------------------------------------------------------------------------

						TABLE 9: INFLOW NEW INVESTORS

------------------------------------------------------------------------------*/

eststo clear

qui eststo: reghdfe nbsub_ig_w1 res00 [aw=w], a(matricule year) vce(cluster matricule year)

qui eststo: reghdfe nbsub_ig_w1 l2share_re l2share_stock l2share_bond l2share_loan (res00=lr) [aw=w], a(matricule year) vce(cluster matricule year) old

estout using "$results/flow-new.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) drop(l2share_* _cons) collabel(none) mlabel(none) varwidth(20)

estout using "$results/flow-new_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)





/*------------------------------------------------------------------------------

						TABLE E.4: FLOW AND REGULATED RATE

------------------------------------------------------------------------------*/

*** collapse all insurers at the year level

use "$output/DA", clear

gen Pa_ig = PM_ouv_ig + (Inflow_ig-Outflow_ig)/2
drop if Reserve_ig_lag==. & year~=1999

collapse (sum) PM_ouv_ig Pa_ig Revalo_ig Inflow_ig Outflow_ig Redemp_ig, by(year)
tsset year

* bring livret A rate
merge 1:1 year using "$source/benchmark-return", keep(1 3) nogen 

* contract return
gen y = Revalo_ig/Pa_ig

* flow
gen inflow_ig = Inflow_ig/PM_ouv_ig
gen outflow_ig = Outflow_ig/PM_ouv_ig
gen redemp_ig = Redemp_ig/PM_ouv_ig
gen forced_ig = (Outflow_ig-Redemp_ig)/PM_ouv_ig
gen flow_ig = inflow_ig-redemp_ig-forced_ig
gen logInflow_ig = log(Inflow_ig)

*** create the figure

label var inflow_ig "Contract inflow (left scale)"
label var y "Contract return (right scale)"
label var r_livreta "Regulated interest rate (right scale)"

tw (line inflow_ig year, lcolor(blue) ytitle("") xtitle("") xlabel(2000(3)2015) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ylabel(,angle(horizontal)) legend(col(1))) (line y r_livret year, yaxis(2) lcolor(red green) lpattern(dash dash) ylabel(,axis(2)angle(horizontal))) 

graph export "$results/flows-regulated-rate.pdf", as(pdf) replace


*** regressions in difference

gen spread = r_livreta-y
label var spread "Return spread"

gen Dspread = d.spread
label var Dspread "Return spread"

eststo clear

foreach x in flow inflow redemp forced logInflow {
	
qui eststo: newey d.`x'_ig Dspread, lag(2)

}

estout using "$results/dflow-livreta.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) drop(_cons) collabel(none) mlabel(none) varwidth(20)

estout using "$results/dflow-livreta_r2.tex", replace style(tex) stats(N, fmt(%8.2g %8.0fc) label("Observations")) drop(*) mlabel(none) collabel(none)


*** regressions in level

gen year2 = year^2

eststo clear

foreach x in flow inflow redemp forced logInflow {
	
qui eststo: reg `x'_ig spread year year2, r

}

estout using "$results/flow-livreta.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) drop(_cons year*) collabel(none) mlabel(none) varwidth(20)

estout using "$results/flow-livreta_r2.tex", replace style(tex) stats(N, fmt(%8.2g %8.0fc) label("Observations")) drop(*) mlabel(none) collabel(none)







/*------------------------------------------------------------------------------

					TABLE 8: RESERVES DECOMPOSITION

------------------------------------------------------------------------------*/

use "$output/DA_reg", clear

* bring information on profit, fees, costs, and reinsurance

merge 1:1 matricule year using "$source/N2V1", keep(1 3) nogen

gen profit = res_tech_ig_N2V1/Pa_ig
gen fees = solde_souscription_ig_N2V1/Pa_ig
gen cost = charges_acq_gest_ig_N2V1/Pa_ig
gen reass = solde_reassurance_ig_N2V1/Pa_ig
gen res = Reserve_ig/PM_clo_ig
gen gPM = log(PM_clo_ig)-log(l.PM_clo_ig)-log(1+y)

* market returns

qui xi: reg r c.lshare_re#i.year c.lshare_stock#i.year c.lshare_bond#i.year c.lshare_loan#i.year i.year
display e(r2)
predict r_idio, res
predict r_syst, xb

/*

Now, we analyze how much of the cross-sectional variation in the change in reserves from t-L and t (for some L>0) is explained by variation in asset returns and contract return from t-L to t.

The program Decomp defined below takes two arguments:
`1' is the lag L
`2' is the list of explanatory variables (asset return and contract return)

It does the following:
-- We take out year FE to focus on cross-sectional variation.
-- To account for mean reversion in reserves, we don't actually use the change in reserves from t-L to t, but we use the level of reserves in t and control for the level of reserves in t-L.

*/


capture program drop Decomp

program define Decomp

*take out year FE and initial reserves and construct the residuals
capture drop res_ini
qui gen res_ini = l`1'.res

*do it for reserves
capture drop *_eps
qui xi: reg res c.res_ini##i.year if year>=2006 [aw=w]	// start in 2006 to have a constant sample when we add variables available only after 2006
qui predict res_eps, res

*do it for the sum of lagged explanatory variables
capture drop temp
local X
local lag = `1'-1
foreach x in `2' {
qui gen temp = 0
forvalues t = 0(1)`lag' {
qui replace temp = temp+l`t'.`x'
}
qui xi: reg temp c.res_ini##i.year if year>=2006 [aw=w]
qui predict `x'_eps, res
local X `X' `x'_eps
drop temp
}

*pooled regression using the residuals
qui reg res_eps `X' if year>=2006 [aw=w]

end




*** Run the program and save the output in a tex file

file open decomposition using "$results/decomposition.tex", text write replace

forvalues h = 1(1)7 {

* R2 when including all variables
Decomp `h' "r y profit fees cost reass gPM"
local totalR2 = e(r2)

* R2 when including each of the variables alone / total R2 (store them in string storeR2)
local storeR2 = ""

* sum the individual R2s
local sumR2 = 0

foreach x in r y "profit fees cost" reass gPM {

Decomp `h' "`x'"

local sumR2 = `sumR2'+e(r2)

local R2 = round(e(r2)/`totalR2',.01)
if `R2'>0 {
	local printR2 = "0" + string(`R2')
}
if `R2'==0 {
	local printR2 = "$<$0.01"
}
local storeR2 = "`storeR2' & `printR2'"

}

* one minus the sum of individual R2s reflect covariances between variables
local R2 = string(round(1-`sumR2'/`totalR2',.01))
if `R2'>0 {
	local printR2 = "0" + string(`R2')
}
if `R2'==0 {
	local printR2 = "$<$0.01"
}
local storeR2 = "`storeR2' & `printR2'"

* write output in tex file
if `h'==1 {
	file write decomposition "$ h = `h'$ year `storeR2' \\" _n
}
if `h'>1 {
	file write decomposition "$ h = `h'$ years `storeR2' \\" _n
}
file write decomposition "\addlinespace" _n

}

file close decomposition



*** Do the same replacing total return by systematic component and idiosyncratic component

file open decomposition using "$results/decomposition-systidio.tex", text write replace

forvalues h = 1(1)7 {

* R2 when including all variables
Decomp `h' "r_syst r_idio y profit fees cost reass gPM"
local totalR2 = e(r2)

* R2 when including each of the variables alone / total R2 (store them in string storeR2)
local storeR2 = ""

* sum the individual R2s
local sumR2 = 0

foreach x in r_syst r_idio y "profit fees cost" reass gPM {

Decomp `h' "`x'"

local sumR2 = `sumR2'+e(r2)

local R2 = round(e(r2)/`totalR2',.01)
if `R2'>0 {
	local printR2 = "0" + string(`R2')
}
if `R2'==0 {
	local printR2 = "$<$0.01"
}
local storeR2 = "`storeR2' & `printR2'"

}

* one minus the sum of individual R2s reflect covariances between variables
local R2 = string(round(1-`sumR2'/`totalR2',.01))
if `R2'>0 {
	local printR2 = "0" + string(`R2')
}
if `R2'==0 {
	local printR2 = "$<$0.01"
}
local storeR2 = "`storeR2' & `printR2'"

* write output in tex file
if `h'==1 {
	file write decomposition "$ h = `h'$ year `storeR2' \\" _n
}
if `h'>1 {
	file write decomposition "$ h = `h'$ years `storeR2' \\" _n
}
file write decomposition "\addlinespace" _n

}

file close decomposition

